package team.seekers.hula.island.island.controller;

import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import team.seekers.hula.auth.service.MindUtils;
import team.seekers.hula.common.annotation.ApiResponseBody;
import team.seekers.hula.common.entity.PageResult;
import team.seekers.hula.island.island.entity.dto.IslandPageDTO;
import team.seekers.hula.island.island.entity.dto.MarkCountDTO;
import team.seekers.hula.island.island.entity.vo.IslandInfoVO;
import team.seekers.hula.island.island.entity.vo.IslandListVO;
import team.seekers.hula.island.island.service.IslandService;

import javax.annotation.Resource;
import java.util.List;

/**
 * @author ekin
 * @Description GOOD
 * @mood happy
 */
@Controller
@ApiResponseBody
@RequestMapping("/island")
public class IslandController {

    @Resource
    private IslandService islandService;


    /**
     *
     * 用户页查询常驻浪屿列表
     */
    @GetMapping("/list/fixed")
    public List<IslandListVO> listFixed() {
        return islandService.listFixed();
    }

    /**
     *
     * 用户页查询推荐浪屿列表
     */
    @GetMapping("/list/push")
    public List<IslandListVO> listPush() {
        return islandService.listPush();
    }

    /**
     *
     * 用户页查询所有浪屿列表
     */
    @GetMapping("/page")
    public PageResult<IslandListVO> page(IslandPageDTO islandPageDTO) {
        islandPageDTO.setUserId(MindUtils.getUserId());
        return islandService.page(islandPageDTO);
    }



    /**
     *
     * 刻入记忆剩余次数
     */
    @GetMapping("/markCount/{islandId}")
    public Integer markCount(MarkCountDTO markCountDTO) {
        return islandService.markCount(markCountDTO);
    }

    /**
     *
     * 浪屿info
     */
    @GetMapping("/info")
    public IslandInfoVO info(@RequestParam String id) {
        return islandService.info(id);
    }
}
